{% extends 'base.html' %}
{% load static %}

{% block title %}我的报名 - 本地有约{% endblock %}

{% block content %}
<div class="container">
    <h3>我的报名</h3>

    {% if registrations %}
    <div class="card shadow">
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>活动标题</th>
                            <th>分类</th>
                            <th>活动时间</th>
                            <th>报名状态</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for reg in registrations %}
                        <tr>
                            <td>
                                <a href="{% url 'activities:activity_detail' reg.activity.id %}" class="text-decoration-none">
                                    {{ reg.activity.title }}
                                </a>
                            </td>
                            <td>{{ reg.activity.category.name }}</td>
                            <td>{{ reg.activity.start_time|date:"Y-m-d H:i" }}</td>
                            <td>
                                {% if reg.is_checked_in %}
                                <span class="badge bg-success">已签到</span>
                                {% else %}
                                <span class="badge bg-primary">已报名</span>
                                {% endif %}
                            </td>
                            <td>
                                <a href="{% url 'activities:activity_detail' reg.activity.id %}" class="btn btn-sm btn-outline-info">
                                    <i class="bi bi-eye"></i> 查看
                                </a>
                            </td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    {% else %}
    <div class="alert alert-info">
        您还没有报名任何活动，快去浏览活动并报名吧！
        <a href="{% url 'activities:activity_list' %}" class="btn btn-primary ms-2">
            浏览活动
        </a>
    </div>
    {% endif %}
</div>
{% endblock %}